<include file='Admin/Tpl/Public/nav.html' />
<style type="text/css">td{ text-align:center}</style>
    <div class="btn-group groups" style="float:right">
        <a href="javascript:void(0)" class="btn btn-danger sub_add" onclick="excel_import()">
            <i class="fa fa-plus"></i> 
            Excel导入
        </a>
    </div>
    <div class="add_bg" style="display:none;background:black;opacity:0.3;position:absolute;z-index:50;top:0px;left:0px;bottom:0px;width:100%;height:"></div>					
    <div class="add_data add_city the-box" style="display:none;border-radius:3px;position:absolute;z-index:100;left:30%;top:30%;" >
        <div class="sub sub_remove" style="float:right;font-size:25px;margin-top:-15px;">x</div>
        <h4 id="title_name">Excel导入:</h4>
        <form action="__URL__/excel_import" method="post" enctype="multipart/form-data">
        <div class="input"></div>	
        <br />
        <input type="submit" style="float:left;margin-right:5px;" class="sub sub_add btn btn-info" value="添加" /> 
        </form>
    </div>

    <div class="btn-group groups" style="float:right">
        <span type="button" class="btn btn-success" >
            <a style="color:white;font-weight:bold" href="__APP__/HomePage/audience_excel">
                Excel文件导出
            </a>
        </span>
    </div>
    <div class="sidebar-right-heading">
        <ul class="nav nav-tabs square nav-justified">
          <li class="active"><a href="#online-user-sidebar" data-toggle="tab"><i class="fa fa-comments"></i></a></li>
          <li><a href="#notification-sidebar" data-toggle="tab"><i class="fa fa-bell"></i></a></li>
          <li><a href="#task-sidebar" data-toggle="tab"><i class="fa fa-tasks"></i></a></li>
          <li><a href="#setting-sidebar" data-toggle="tab"><i class="fa fa-cogs"></i></a></li>
        </ul>
    </div>
    <div class="page-content">
        <div class="container-fluid">
            <br/>
            
			<div class="col-sm-3 left">
                <div class="the-box">
                	<h4>添加类型</h4>
                    <form id="ExampleBootstrapValidationForm" method="post" action="__URL__/addAct" enctype="multipart/form-data">
                        <div class="form-group">
                            <label>类型名称<span style="color:red">*</span></label>
                            <div>
                                <input type="text" class="form-control must" type="text" name="type_name" />
                            </div>
                        </div>
                                                
                        <div class="form-group">
                             <input class="btn btn-primary" id="submit"  type="submit" value="添加" />
                        </div>
                    </form>
                </div>
            </div>
            
			<div class="col-sm-9 right">
                <div class="the-box">
        
                    <div class="table-responsive div1 div_search">
                        <table class="table table-th-block table-hover">
                            <thead>
                                <tr>
                                    <td width="80px" style="text-align:center">编号</td>
                                    <td width="80px" style="text-align:center">名称</td>
                                    <td width="60px" style="text-align:center">操作</td>
                                </tr>
                            </thead>
                            <tbody>
                                <foreach name="rs.data" item="value">
                                    <tr>
                                        <td>{$value.type_id}</td>
                                        <td>{$value.type_name}</td>
                                        <td style="width:90px;">
                                            <span class="save" name="{$value.type_id}" style="cursor:pointer">
                                                修改
                                            </span>
                                            &nbsp;|&nbsp;  
                                            <span class="delete">
                                                <a href='javascript:void(0)' onclick='to_del({$value.type_id})' title='Delete'>删除</a>
                                            </span>
                                        </td>
                                    </tr>
                                </foreach>
                            </tbody>
                        </table>
                        <ul class="pagination success">{$rs.show}</ul>
                    </div>
                    <div class="table-responsive" id="hl"></div>
                </div>
             </div>
             <!--end cols-8-->
        </div>
    </div>
</div>
</body>
</html>
<script src="__PUBLIC__/Js/add_form.js"></script>
<script type="text/javascript">
$(".current").css({background:"#8CC152",color:"white"});

//修改
$(".save").click(function(){
    var id = $(this).attr("name");
    $.ajax({
        url:"__URL__/to_update",
        data:{"type_id":id},
        type:"get",
        success:function(data){
            $(".div1").css({display:"none"});
            $("#hl").html(data);
        }
    });
});

//删除

function to_del(a){
    if(confirm("确认删除?")){
        $.get('__URL__/delAct?type_id='+a,'',function(){window.location='__SELF__';},'json');  
    }
}


function excel_import()
{
	$("#title_name").text("Excel文件导入:");
	$(".input").html("<a href='__PUBLIC__/phpExcel/example.xls'>点击下载固定excel格式模板(限xls)</a><br/><br/><input style='margin-bottom:5px' class='local_name form-control must' id='local' type='file' name='excel' />");							
	$(".add_bg").css({display:"block"});
	$(".add_city").css({display:"block"});

	$(".sub_remove").click(function(){
		$(".add_bg").css({display:"none"});
		$(".add_city").css({display:"none"});
	});
}
</script>